<?php
	/**
	 * The abstract MantisBugTableGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the MantisBugTable subclass which
	 * extends this MantisBugTableGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the MantisBugTable class.
	 *
	 * @package My QCubed Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $ProjectId the value for intProjectId (Not Null)
	 * @property integer $ReporterId the value for intReporterId (Not Null)
	 * @property integer $HandlerId the value for intHandlerId (Not Null)
	 * @property integer $DuplicateId the value for intDuplicateId (Not Null)
	 * @property integer $Priority the value for intPriority (Not Null)
	 * @property integer $Severity the value for intSeverity (Not Null)
	 * @property integer $Reproducibility the value for intReproducibility (Not Null)
	 * @property integer $Status the value for intStatus (Not Null)
	 * @property integer $Resolution the value for intResolution (Not Null)
	 * @property integer $Projection the value for intProjection (Not Null)
	 * @property integer $Eta the value for intEta (Not Null)
	 * @property integer $BugTextId the value for intBugTextId (Not Null)
	 * @property string $Os the value for strOs (Not Null)
	 * @property string $OsBuild the value for strOsBuild (Not Null)
	 * @property string $Platform the value for strPlatform (Not Null)
	 * @property string $Version the value for strVersion (Not Null)
	 * @property string $FixedInVersion the value for strFixedInVersion (Not Null)
	 * @property string $Build the value for strBuild (Not Null)
	 * @property integer $ProfileId the value for intProfileId (Not Null)
	 * @property integer $ViewState the value for intViewState (Not Null)
	 * @property string $Summary the value for strSummary (Not Null)
	 * @property integer $SponsorshipTotal the value for intSponsorshipTotal (Not Null)
	 * @property integer $Sticky the value for intSticky (Not Null)
	 * @property string $TargetVersion the value for strTargetVersion (Not Null)
	 * @property integer $CategoryId the value for intCategoryId (Not Null)
	 * @property integer $DateSubmitted the value for intDateSubmitted (Not Null)
	 * @property integer $DueDate the value for intDueDate (Not Null)
	 * @property integer $LastUpdated the value for intLastUpdated (Not Null)
	 * @property integer $IncludedInBuildVersion the value for intIncludedInBuildVersion 
	 * @property QDateTime $StartDate the value for dttStartDate 
	 * @property QDateTime $EndDate the value for dttEndDate 
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class MantisBugTableGen extends QBaseClass implements IteratorAggregate {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////

		/**
		 * Protected member variable that maps to the database PK Identity column mantis_bug_table.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.project_id
		 * @var integer intProjectId
		 */
		protected $intProjectId;
		const ProjectIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.reporter_id
		 * @var integer intReporterId
		 */
		protected $intReporterId;
		const ReporterIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.handler_id
		 * @var integer intHandlerId
		 */
		protected $intHandlerId;
		const HandlerIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.duplicate_id
		 * @var integer intDuplicateId
		 */
		protected $intDuplicateId;
		const DuplicateIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.priority
		 * @var integer intPriority
		 */
		protected $intPriority;
		const PriorityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.severity
		 * @var integer intSeverity
		 */
		protected $intSeverity;
		const SeverityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.reproducibility
		 * @var integer intReproducibility
		 */
		protected $intReproducibility;
		const ReproducibilityDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.status
		 * @var integer intStatus
		 */
		protected $intStatus;
		const StatusDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.resolution
		 * @var integer intResolution
		 */
		protected $intResolution;
		const ResolutionDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.projection
		 * @var integer intProjection
		 */
		protected $intProjection;
		const ProjectionDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.eta
		 * @var integer intEta
		 */
		protected $intEta;
		const EtaDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.bug_text_id
		 * @var integer intBugTextId
		 */
		protected $intBugTextId;
		const BugTextIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.os
		 * @var string strOs
		 */
		protected $strOs;
		const OsMaxLength = 32;
		const OsDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.os_build
		 * @var string strOsBuild
		 */
		protected $strOsBuild;
		const OsBuildMaxLength = 32;
		const OsBuildDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.platform
		 * @var string strPlatform
		 */
		protected $strPlatform;
		const PlatformMaxLength = 32;
		const PlatformDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.version
		 * @var string strVersion
		 */
		protected $strVersion;
		const VersionMaxLength = 64;
		const VersionDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.fixed_in_version
		 * @var string strFixedInVersion
		 */
		protected $strFixedInVersion;
		const FixedInVersionMaxLength = 64;
		const FixedInVersionDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.build
		 * @var string strBuild
		 */
		protected $strBuild;
		const BuildMaxLength = 32;
		const BuildDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.profile_id
		 * @var integer intProfileId
		 */
		protected $intProfileId;
		const ProfileIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.view_state
		 * @var integer intViewState
		 */
		protected $intViewState;
		const ViewStateDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.summary
		 * @var string strSummary
		 */
		protected $strSummary;
		const SummaryMaxLength = 128;
		const SummaryDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.sponsorship_total
		 * @var integer intSponsorshipTotal
		 */
		protected $intSponsorshipTotal;
		const SponsorshipTotalDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.sticky
		 * @var integer intSticky
		 */
		protected $intSticky;
		const StickyDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.target_version
		 * @var string strTargetVersion
		 */
		protected $strTargetVersion;
		const TargetVersionMaxLength = 64;
		const TargetVersionDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.category_id
		 * @var integer intCategoryId
		 */
		protected $intCategoryId;
		const CategoryIdDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.date_submitted
		 * @var integer intDateSubmitted
		 */
		protected $intDateSubmitted;
		const DateSubmittedDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.due_date
		 * @var integer intDueDate
		 */
		protected $intDueDate;
		const DueDateDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.last_updated
		 * @var integer intLastUpdated
		 */
		protected $intLastUpdated;
		const LastUpdatedDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.included_in_build_version
		 * @var integer intIncludedInBuildVersion
		 */
		protected $intIncludedInBuildVersion;
		const IncludedInBuildVersionDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.start_date
		 * @var QDateTime dttStartDate
		 */
		protected $dttStartDate;
		const StartDateDefault = null;


		/**
		 * Protected member variable that maps to the database column mantis_bug_table.end_date
		 * @var QDateTime dttEndDate
		 */
		protected $dttEndDate;
		const EndDateDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////



		/**
		 * Initialize each property with default values from database definition
		 */
		public function Initialize()
		{
			$this->intId = MantisBugTable::IdDefault;
			$this->intProjectId = MantisBugTable::ProjectIdDefault;
			$this->intReporterId = MantisBugTable::ReporterIdDefault;
			$this->intHandlerId = MantisBugTable::HandlerIdDefault;
			$this->intDuplicateId = MantisBugTable::DuplicateIdDefault;
			$this->intPriority = MantisBugTable::PriorityDefault;
			$this->intSeverity = MantisBugTable::SeverityDefault;
			$this->intReproducibility = MantisBugTable::ReproducibilityDefault;
			$this->intStatus = MantisBugTable::StatusDefault;
			$this->intResolution = MantisBugTable::ResolutionDefault;
			$this->intProjection = MantisBugTable::ProjectionDefault;
			$this->intEta = MantisBugTable::EtaDefault;
			$this->intBugTextId = MantisBugTable::BugTextIdDefault;
			$this->strOs = MantisBugTable::OsDefault;
			$this->strOsBuild = MantisBugTable::OsBuildDefault;
			$this->strPlatform = MantisBugTable::PlatformDefault;
			$this->strVersion = MantisBugTable::VersionDefault;
			$this->strFixedInVersion = MantisBugTable::FixedInVersionDefault;
			$this->strBuild = MantisBugTable::BuildDefault;
			$this->intProfileId = MantisBugTable::ProfileIdDefault;
			$this->intViewState = MantisBugTable::ViewStateDefault;
			$this->strSummary = MantisBugTable::SummaryDefault;
			$this->intSponsorshipTotal = MantisBugTable::SponsorshipTotalDefault;
			$this->intSticky = MantisBugTable::StickyDefault;
			$this->strTargetVersion = MantisBugTable::TargetVersionDefault;
			$this->intCategoryId = MantisBugTable::CategoryIdDefault;
			$this->intDateSubmitted = MantisBugTable::DateSubmittedDefault;
			$this->intDueDate = MantisBugTable::DueDateDefault;
			$this->intLastUpdated = MantisBugTable::LastUpdatedDefault;
			$this->intIncludedInBuildVersion = MantisBugTable::IncludedInBuildVersionDefault;
			$this->dttStartDate = (MantisBugTable::StartDateDefault === null)?null:new QDateTime(MantisBugTable::StartDateDefault);
			$this->dttEndDate = (MantisBugTable::EndDateDefault === null)?null:new QDateTime(MantisBugTable::EndDateDefault);
		}


		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a MantisBugTable from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return MantisBugTable::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::MantisBugTable()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all MantisBugTables
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call MantisBugTable::QueryArray to perform the LoadAll query
			try {
				return MantisBugTable::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all MantisBugTables
		 * @return int
		 */
		public static function CountAll() {
			// Call MantisBugTable::QueryCount to perform the CountAll query
			return MantisBugTable::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = MantisBugTable::GetDatabase();

			// Create/Build out the QueryBuilder object with MantisBugTable-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'mantis_bug_table');
			MantisBugTable::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('mantis_bug_table');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single MantisBugTable object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return MantisBugTable the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = MantisBugTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query, Get the First Row, and Instantiate a new MantisBugTable object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = MantisBugTable::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;
				}
				if (count($objToReturn)) {
					// Since we only want the object to return, lets return the object and not the array.
					return $objToReturn[0];
				} else {
					return null;
				}
			} else {
				// No expands just return the first row
				$objDbRow = $objDbResult->GetNextRow();
				if(null === $objDbRow)
					return null;
				return MantisBugTable::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
		}

		/**
		 * Static Qcubed Query method to query for an array of MantisBugTable objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return MantisBugTable[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = MantisBugTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return MantisBugTable::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of MantisBugTable objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = MantisBugTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = MantisBugTable::GetDatabase();

			$strQuery = MantisBugTable::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);

			$objCache = new QCache('qquery/mantisbugtable', $strQuery);
			$cacheData = $objCache->GetData();

			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = MantisBugTable::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}

			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this MantisBugTable
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'mantis_bug_table';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'project_id', $strAliasPrefix . 'project_id');
			$objBuilder->AddSelectItem($strTableName, 'reporter_id', $strAliasPrefix . 'reporter_id');
			$objBuilder->AddSelectItem($strTableName, 'handler_id', $strAliasPrefix . 'handler_id');
			$objBuilder->AddSelectItem($strTableName, 'duplicate_id', $strAliasPrefix . 'duplicate_id');
			$objBuilder->AddSelectItem($strTableName, 'priority', $strAliasPrefix . 'priority');
			$objBuilder->AddSelectItem($strTableName, 'severity', $strAliasPrefix . 'severity');
			$objBuilder->AddSelectItem($strTableName, 'reproducibility', $strAliasPrefix . 'reproducibility');
			$objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
			$objBuilder->AddSelectItem($strTableName, 'resolution', $strAliasPrefix . 'resolution');
			$objBuilder->AddSelectItem($strTableName, 'projection', $strAliasPrefix . 'projection');
			$objBuilder->AddSelectItem($strTableName, 'eta', $strAliasPrefix . 'eta');
			$objBuilder->AddSelectItem($strTableName, 'bug_text_id', $strAliasPrefix . 'bug_text_id');
			$objBuilder->AddSelectItem($strTableName, 'os', $strAliasPrefix . 'os');
			$objBuilder->AddSelectItem($strTableName, 'os_build', $strAliasPrefix . 'os_build');
			$objBuilder->AddSelectItem($strTableName, 'platform', $strAliasPrefix . 'platform');
			$objBuilder->AddSelectItem($strTableName, 'version', $strAliasPrefix . 'version');
			$objBuilder->AddSelectItem($strTableName, 'fixed_in_version', $strAliasPrefix . 'fixed_in_version');
			$objBuilder->AddSelectItem($strTableName, 'build', $strAliasPrefix . 'build');
			$objBuilder->AddSelectItem($strTableName, 'profile_id', $strAliasPrefix . 'profile_id');
			$objBuilder->AddSelectItem($strTableName, 'view_state', $strAliasPrefix . 'view_state');
			$objBuilder->AddSelectItem($strTableName, 'summary', $strAliasPrefix . 'summary');
			$objBuilder->AddSelectItem($strTableName, 'sponsorship_total', $strAliasPrefix . 'sponsorship_total');
			$objBuilder->AddSelectItem($strTableName, 'sticky', $strAliasPrefix . 'sticky');
			$objBuilder->AddSelectItem($strTableName, 'target_version', $strAliasPrefix . 'target_version');
			$objBuilder->AddSelectItem($strTableName, 'category_id', $strAliasPrefix . 'category_id');
			$objBuilder->AddSelectItem($strTableName, 'date_submitted', $strAliasPrefix . 'date_submitted');
			$objBuilder->AddSelectItem($strTableName, 'due_date', $strAliasPrefix . 'due_date');
			$objBuilder->AddSelectItem($strTableName, 'last_updated', $strAliasPrefix . 'last_updated');
			$objBuilder->AddSelectItem($strTableName, 'included_in_build_version', $strAliasPrefix . 'included_in_build_version');
			$objBuilder->AddSelectItem($strTableName, 'start_date', $strAliasPrefix . 'start_date');
			$objBuilder->AddSelectItem($strTableName, 'end_date', $strAliasPrefix . 'end_date');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a MantisBugTable from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this MantisBugTable::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return MantisBugTable
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the MantisBugTable object
			$objToReturn = new MantisBugTable();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'project_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'project_id'] : $strAliasPrefix . 'project_id';
			$objToReturn->intProjectId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'reporter_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'reporter_id'] : $strAliasPrefix . 'reporter_id';
			$objToReturn->intReporterId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'handler_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'handler_id'] : $strAliasPrefix . 'handler_id';
			$objToReturn->intHandlerId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'duplicate_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'duplicate_id'] : $strAliasPrefix . 'duplicate_id';
			$objToReturn->intDuplicateId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'priority', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'priority'] : $strAliasPrefix . 'priority';
			$objToReturn->intPriority = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'severity', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'severity'] : $strAliasPrefix . 'severity';
			$objToReturn->intSeverity = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'reproducibility', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'reproducibility'] : $strAliasPrefix . 'reproducibility';
			$objToReturn->intReproducibility = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
			$objToReturn->intStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'resolution', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'resolution'] : $strAliasPrefix . 'resolution';
			$objToReturn->intResolution = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'projection', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'projection'] : $strAliasPrefix . 'projection';
			$objToReturn->intProjection = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'eta', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'eta'] : $strAliasPrefix . 'eta';
			$objToReturn->intEta = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'bug_text_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'bug_text_id'] : $strAliasPrefix . 'bug_text_id';
			$objToReturn->intBugTextId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'os', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'os'] : $strAliasPrefix . 'os';
			$objToReturn->strOs = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'os_build', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'os_build'] : $strAliasPrefix . 'os_build';
			$objToReturn->strOsBuild = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'platform', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'platform'] : $strAliasPrefix . 'platform';
			$objToReturn->strPlatform = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'version', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'version'] : $strAliasPrefix . 'version';
			$objToReturn->strVersion = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'fixed_in_version', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fixed_in_version'] : $strAliasPrefix . 'fixed_in_version';
			$objToReturn->strFixedInVersion = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'build', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'build'] : $strAliasPrefix . 'build';
			$objToReturn->strBuild = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'profile_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'profile_id'] : $strAliasPrefix . 'profile_id';
			$objToReturn->intProfileId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'view_state', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'view_state'] : $strAliasPrefix . 'view_state';
			$objToReturn->intViewState = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'summary', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'summary'] : $strAliasPrefix . 'summary';
			$objToReturn->strSummary = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'sponsorship_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'sponsorship_total'] : $strAliasPrefix . 'sponsorship_total';
			$objToReturn->intSponsorshipTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'sticky', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'sticky'] : $strAliasPrefix . 'sticky';
			$objToReturn->intSticky = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'target_version', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'target_version'] : $strAliasPrefix . 'target_version';
			$objToReturn->strTargetVersion = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'category_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'category_id'] : $strAliasPrefix . 'category_id';
			$objToReturn->intCategoryId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'date_submitted', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'date_submitted'] : $strAliasPrefix . 'date_submitted';
			$objToReturn->intDateSubmitted = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'due_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'due_date'] : $strAliasPrefix . 'due_date';
			$objToReturn->intDueDate = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'last_updated', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'last_updated'] : $strAliasPrefix . 'last_updated';
			$objToReturn->intLastUpdated = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'included_in_build_version', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'included_in_build_version'] : $strAliasPrefix . 'included_in_build_version';
			$objToReturn->intIncludedInBuildVersion = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'start_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'start_date'] : $strAliasPrefix . 'start_date';
			$objToReturn->dttStartDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'end_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'end_date'] : $strAliasPrefix . 'end_date';
			$objToReturn->dttEndDate = $objDbRow->GetColumn($strAliasName, 'DateTime');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'mantis_bug_table__';




			return $objToReturn;
		}

		/**
		 * Instantiate an array of MantisBugTables from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return MantisBugTable[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();

			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = MantisBugTable::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = MantisBugTable::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single MantisBugTable object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return MantisBugTable::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::MantisBugTable()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of MantisBugTable objects,
		 * by SponsorshipTotal Index(es)
		 * @param integer $intSponsorshipTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		*/
		public static function LoadArrayBySponsorshipTotal($intSponsorshipTotal, $objOptionalClauses = null) {
			// Call MantisBugTable::QueryArray to perform the LoadArrayBySponsorshipTotal query
			try {
				return MantisBugTable::QueryArray(
					QQ::Equal(QQN::MantisBugTable()->SponsorshipTotal, $intSponsorshipTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count MantisBugTables
		 * by SponsorshipTotal Index(es)
		 * @param integer $intSponsorshipTotal
		 * @return int
		*/
		public static function CountBySponsorshipTotal($intSponsorshipTotal) {
			// Call MantisBugTable::QueryCount to perform the CountBySponsorshipTotal query
			return MantisBugTable::QueryCount(
				QQ::Equal(QQN::MantisBugTable()->SponsorshipTotal, $intSponsorshipTotal)
			);
		}
			
		/**
		 * Load an array of MantisBugTable objects,
		 * by FixedInVersion Index(es)
		 * @param string $strFixedInVersion
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		*/
		public static function LoadArrayByFixedInVersion($strFixedInVersion, $objOptionalClauses = null) {
			// Call MantisBugTable::QueryArray to perform the LoadArrayByFixedInVersion query
			try {
				return MantisBugTable::QueryArray(
					QQ::Equal(QQN::MantisBugTable()->FixedInVersion, $strFixedInVersion),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count MantisBugTables
		 * by FixedInVersion Index(es)
		 * @param string $strFixedInVersion
		 * @return int
		*/
		public static function CountByFixedInVersion($strFixedInVersion) {
			// Call MantisBugTable::QueryCount to perform the CountByFixedInVersion query
			return MantisBugTable::QueryCount(
				QQ::Equal(QQN::MantisBugTable()->FixedInVersion, $strFixedInVersion)
			);
		}
			
		/**
		 * Load an array of MantisBugTable objects,
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		*/
		public static function LoadArrayByStatus($intStatus, $objOptionalClauses = null) {
			// Call MantisBugTable::QueryArray to perform the LoadArrayByStatus query
			try {
				return MantisBugTable::QueryArray(
					QQ::Equal(QQN::MantisBugTable()->Status, $intStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count MantisBugTables
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByStatus($intStatus) {
			// Call MantisBugTable::QueryCount to perform the CountByStatus query
			return MantisBugTable::QueryCount(
				QQ::Equal(QQN::MantisBugTable()->Status, $intStatus)
			);
		}
			
		/**
		 * Load an array of MantisBugTable objects,
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		*/
		public static function LoadArrayByProjectId($intProjectId, $objOptionalClauses = null) {
			// Call MantisBugTable::QueryArray to perform the LoadArrayByProjectId query
			try {
				return MantisBugTable::QueryArray(
					QQ::Equal(QQN::MantisBugTable()->ProjectId, $intProjectId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count MantisBugTables
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @return int
		*/
		public static function CountByProjectId($intProjectId) {
			// Call MantisBugTable::QueryCount to perform the CountByProjectId query
			return MantisBugTable::QueryCount(
				QQ::Equal(QQN::MantisBugTable()->ProjectId, $intProjectId)
			);
		}
			
		/**
		 * Load an array of MantisBugTable objects,
		 * by ProjectId, Status Index(es)
		 * @param integer $intProjectId
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		*/
		public static function LoadArrayByProjectIdStatus($intProjectId, $intStatus, $objOptionalClauses = null) {
			// Call MantisBugTable::QueryArray to perform the LoadArrayByProjectIdStatus query
			try {
				return MantisBugTable::QueryArray(
					QQ::AndCondition(
					QQ::Equal(QQN::MantisBugTable()->ProjectId, $intProjectId),
					QQ::Equal(QQN::MantisBugTable()->Status, $intStatus)
					),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count MantisBugTables
		 * by ProjectId, Status Index(es)
		 * @param integer $intProjectId
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByProjectIdStatus($intProjectId, $intStatus) {
			// Call MantisBugTable::QueryCount to perform the CountByProjectIdStatus query
			return MantisBugTable::QueryCount(
				QQ::AndCondition(
				QQ::Equal(QQN::MantisBugTable()->ProjectId, $intProjectId),
				QQ::Equal(QQN::MantisBugTable()->Status, $intStatus)
				)
			);
		}
			
		/**
		 * Load an array of MantisBugTable objects,
		 * by IncludedInBuildVersion Index(es)
		 * @param integer $intIncludedInBuildVersion
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return MantisBugTable[]
		*/
		public static function LoadArrayByIncludedInBuildVersion($intIncludedInBuildVersion, $objOptionalClauses = null) {
			// Call MantisBugTable::QueryArray to perform the LoadArrayByIncludedInBuildVersion query
			try {
				return MantisBugTable::QueryArray(
					QQ::Equal(QQN::MantisBugTable()->IncludedInBuildVersion, $intIncludedInBuildVersion),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count MantisBugTables
		 * by IncludedInBuildVersion Index(es)
		 * @param integer $intIncludedInBuildVersion
		 * @return int
		*/
		public static function CountByIncludedInBuildVersion($intIncludedInBuildVersion) {
			// Call MantisBugTable::QueryCount to perform the CountByIncludedInBuildVersion query
			return MantisBugTable::QueryCount(
				QQ::Equal(QQN::MantisBugTable()->IncludedInBuildVersion, $intIncludedInBuildVersion)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this MantisBugTable
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = MantisBugTable::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `mantis_bug_table` (
							`project_id`,
							`reporter_id`,
							`handler_id`,
							`duplicate_id`,
							`priority`,
							`severity`,
							`reproducibility`,
							`status`,
							`resolution`,
							`projection`,
							`eta`,
							`bug_text_id`,
							`os`,
							`os_build`,
							`platform`,
							`version`,
							`fixed_in_version`,
							`build`,
							`profile_id`,
							`view_state`,
							`summary`,
							`sponsorship_total`,
							`sticky`,
							`target_version`,
							`category_id`,
							`date_submitted`,
							`due_date`,
							`last_updated`,
							`included_in_build_version`,
							`start_date`,
							`end_date`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intProjectId) . ',
							' . $objDatabase->SqlVariable($this->intReporterId) . ',
							' . $objDatabase->SqlVariable($this->intHandlerId) . ',
							' . $objDatabase->SqlVariable($this->intDuplicateId) . ',
							' . $objDatabase->SqlVariable($this->intPriority) . ',
							' . $objDatabase->SqlVariable($this->intSeverity) . ',
							' . $objDatabase->SqlVariable($this->intReproducibility) . ',
							' . $objDatabase->SqlVariable($this->intStatus) . ',
							' . $objDatabase->SqlVariable($this->intResolution) . ',
							' . $objDatabase->SqlVariable($this->intProjection) . ',
							' . $objDatabase->SqlVariable($this->intEta) . ',
							' . $objDatabase->SqlVariable($this->intBugTextId) . ',
							' . $objDatabase->SqlVariable($this->strOs) . ',
							' . $objDatabase->SqlVariable($this->strOsBuild) . ',
							' . $objDatabase->SqlVariable($this->strPlatform) . ',
							' . $objDatabase->SqlVariable($this->strVersion) . ',
							' . $objDatabase->SqlVariable($this->strFixedInVersion) . ',
							' . $objDatabase->SqlVariable($this->strBuild) . ',
							' . $objDatabase->SqlVariable($this->intProfileId) . ',
							' . $objDatabase->SqlVariable($this->intViewState) . ',
							' . $objDatabase->SqlVariable($this->strSummary) . ',
							' . $objDatabase->SqlVariable($this->intSponsorshipTotal) . ',
							' . $objDatabase->SqlVariable($this->intSticky) . ',
							' . $objDatabase->SqlVariable($this->strTargetVersion) . ',
							' . $objDatabase->SqlVariable($this->intCategoryId) . ',
							' . $objDatabase->SqlVariable($this->intDateSubmitted) . ',
							' . $objDatabase->SqlVariable($this->intDueDate) . ',
							' . $objDatabase->SqlVariable($this->intLastUpdated) . ',
							' . $objDatabase->SqlVariable($this->intIncludedInBuildVersion) . ',
							' . $objDatabase->SqlVariable($this->dttStartDate) . ',
							' . $objDatabase->SqlVariable($this->dttEndDate) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('mantis_bug_table', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`mantis_bug_table`
						SET
							`project_id` = ' . $objDatabase->SqlVariable($this->intProjectId) . ',
							`reporter_id` = ' . $objDatabase->SqlVariable($this->intReporterId) . ',
							`handler_id` = ' . $objDatabase->SqlVariable($this->intHandlerId) . ',
							`duplicate_id` = ' . $objDatabase->SqlVariable($this->intDuplicateId) . ',
							`priority` = ' . $objDatabase->SqlVariable($this->intPriority) . ',
							`severity` = ' . $objDatabase->SqlVariable($this->intSeverity) . ',
							`reproducibility` = ' . $objDatabase->SqlVariable($this->intReproducibility) . ',
							`status` = ' . $objDatabase->SqlVariable($this->intStatus) . ',
							`resolution` = ' . $objDatabase->SqlVariable($this->intResolution) . ',
							`projection` = ' . $objDatabase->SqlVariable($this->intProjection) . ',
							`eta` = ' . $objDatabase->SqlVariable($this->intEta) . ',
							`bug_text_id` = ' . $objDatabase->SqlVariable($this->intBugTextId) . ',
							`os` = ' . $objDatabase->SqlVariable($this->strOs) . ',
							`os_build` = ' . $objDatabase->SqlVariable($this->strOsBuild) . ',
							`platform` = ' . $objDatabase->SqlVariable($this->strPlatform) . ',
							`version` = ' . $objDatabase->SqlVariable($this->strVersion) . ',
							`fixed_in_version` = ' . $objDatabase->SqlVariable($this->strFixedInVersion) . ',
							`build` = ' . $objDatabase->SqlVariable($this->strBuild) . ',
							`profile_id` = ' . $objDatabase->SqlVariable($this->intProfileId) . ',
							`view_state` = ' . $objDatabase->SqlVariable($this->intViewState) . ',
							`summary` = ' . $objDatabase->SqlVariable($this->strSummary) . ',
							`sponsorship_total` = ' . $objDatabase->SqlVariable($this->intSponsorshipTotal) . ',
							`sticky` = ' . $objDatabase->SqlVariable($this->intSticky) . ',
							`target_version` = ' . $objDatabase->SqlVariable($this->strTargetVersion) . ',
							`category_id` = ' . $objDatabase->SqlVariable($this->intCategoryId) . ',
							`date_submitted` = ' . $objDatabase->SqlVariable($this->intDateSubmitted) . ',
							`due_date` = ' . $objDatabase->SqlVariable($this->intDueDate) . ',
							`last_updated` = ' . $objDatabase->SqlVariable($this->intLastUpdated) . ',
							`included_in_build_version` = ' . $objDatabase->SqlVariable($this->intIncludedInBuildVersion) . ',
							`start_date` = ' . $objDatabase->SqlVariable($this->dttStartDate) . ',
							`end_date` = ' . $objDatabase->SqlVariable($this->dttEndDate) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return
			return $mixToReturn;
		}

		/**
		 * Delete this MantisBugTable
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this MantisBugTable with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = MantisBugTable::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`mantis_bug_table`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all MantisBugTables
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = MantisBugTable::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`mantis_bug_table`');
		}

		/**
		 * Truncate mantis_bug_table table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = MantisBugTable::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `mantis_bug_table`');
		}

		/**
		 * Reload this MantisBugTable from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved MantisBugTable object.');

			// Reload the Object
			$objReloaded = MantisBugTable::Load($this->intId);

			// Update $this's local variables to match
			$this->intProjectId = $objReloaded->intProjectId;
			$this->intReporterId = $objReloaded->intReporterId;
			$this->intHandlerId = $objReloaded->intHandlerId;
			$this->intDuplicateId = $objReloaded->intDuplicateId;
			$this->intPriority = $objReloaded->intPriority;
			$this->intSeverity = $objReloaded->intSeverity;
			$this->intReproducibility = $objReloaded->intReproducibility;
			$this->intStatus = $objReloaded->intStatus;
			$this->intResolution = $objReloaded->intResolution;
			$this->intProjection = $objReloaded->intProjection;
			$this->intEta = $objReloaded->intEta;
			$this->intBugTextId = $objReloaded->intBugTextId;
			$this->strOs = $objReloaded->strOs;
			$this->strOsBuild = $objReloaded->strOsBuild;
			$this->strPlatform = $objReloaded->strPlatform;
			$this->strVersion = $objReloaded->strVersion;
			$this->strFixedInVersion = $objReloaded->strFixedInVersion;
			$this->strBuild = $objReloaded->strBuild;
			$this->intProfileId = $objReloaded->intProfileId;
			$this->intViewState = $objReloaded->intViewState;
			$this->strSummary = $objReloaded->strSummary;
			$this->intSponsorshipTotal = $objReloaded->intSponsorshipTotal;
			$this->intSticky = $objReloaded->intSticky;
			$this->strTargetVersion = $objReloaded->strTargetVersion;
			$this->intCategoryId = $objReloaded->intCategoryId;
			$this->intDateSubmitted = $objReloaded->intDateSubmitted;
			$this->intDueDate = $objReloaded->intDueDate;
			$this->intLastUpdated = $objReloaded->intLastUpdated;
			$this->intIncludedInBuildVersion = $objReloaded->intIncludedInBuildVersion;
			$this->dttStartDate = $objReloaded->dttStartDate;
			$this->dttEndDate = $objReloaded->dttEndDate;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'ProjectId':
					/**
					 * Gets the value for intProjectId (Not Null)
					 * @return integer
					 */
					return $this->intProjectId;

				case 'ReporterId':
					/**
					 * Gets the value for intReporterId (Not Null)
					 * @return integer
					 */
					return $this->intReporterId;

				case 'HandlerId':
					/**
					 * Gets the value for intHandlerId (Not Null)
					 * @return integer
					 */
					return $this->intHandlerId;

				case 'DuplicateId':
					/**
					 * Gets the value for intDuplicateId (Not Null)
					 * @return integer
					 */
					return $this->intDuplicateId;

				case 'Priority':
					/**
					 * Gets the value for intPriority (Not Null)
					 * @return integer
					 */
					return $this->intPriority;

				case 'Severity':
					/**
					 * Gets the value for intSeverity (Not Null)
					 * @return integer
					 */
					return $this->intSeverity;

				case 'Reproducibility':
					/**
					 * Gets the value for intReproducibility (Not Null)
					 * @return integer
					 */
					return $this->intReproducibility;

				case 'Status':
					/**
					 * Gets the value for intStatus (Not Null)
					 * @return integer
					 */
					return $this->intStatus;

				case 'Resolution':
					/**
					 * Gets the value for intResolution (Not Null)
					 * @return integer
					 */
					return $this->intResolution;

				case 'Projection':
					/**
					 * Gets the value for intProjection (Not Null)
					 * @return integer
					 */
					return $this->intProjection;

				case 'Eta':
					/**
					 * Gets the value for intEta (Not Null)
					 * @return integer
					 */
					return $this->intEta;

				case 'BugTextId':
					/**
					 * Gets the value for intBugTextId (Not Null)
					 * @return integer
					 */
					return $this->intBugTextId;

				case 'Os':
					/**
					 * Gets the value for strOs (Not Null)
					 * @return string
					 */
					return $this->strOs;

				case 'OsBuild':
					/**
					 * Gets the value for strOsBuild (Not Null)
					 * @return string
					 */
					return $this->strOsBuild;

				case 'Platform':
					/**
					 * Gets the value for strPlatform (Not Null)
					 * @return string
					 */
					return $this->strPlatform;

				case 'Version':
					/**
					 * Gets the value for strVersion (Not Null)
					 * @return string
					 */
					return $this->strVersion;

				case 'FixedInVersion':
					/**
					 * Gets the value for strFixedInVersion (Not Null)
					 * @return string
					 */
					return $this->strFixedInVersion;

				case 'Build':
					/**
					 * Gets the value for strBuild (Not Null)
					 * @return string
					 */
					return $this->strBuild;

				case 'ProfileId':
					/**
					 * Gets the value for intProfileId (Not Null)
					 * @return integer
					 */
					return $this->intProfileId;

				case 'ViewState':
					/**
					 * Gets the value for intViewState (Not Null)
					 * @return integer
					 */
					return $this->intViewState;

				case 'Summary':
					/**
					 * Gets the value for strSummary (Not Null)
					 * @return string
					 */
					return $this->strSummary;

				case 'SponsorshipTotal':
					/**
					 * Gets the value for intSponsorshipTotal (Not Null)
					 * @return integer
					 */
					return $this->intSponsorshipTotal;

				case 'Sticky':
					/**
					 * Gets the value for intSticky (Not Null)
					 * @return integer
					 */
					return $this->intSticky;

				case 'TargetVersion':
					/**
					 * Gets the value for strTargetVersion (Not Null)
					 * @return string
					 */
					return $this->strTargetVersion;

				case 'CategoryId':
					/**
					 * Gets the value for intCategoryId (Not Null)
					 * @return integer
					 */
					return $this->intCategoryId;

				case 'DateSubmitted':
					/**
					 * Gets the value for intDateSubmitted (Not Null)
					 * @return integer
					 */
					return $this->intDateSubmitted;

				case 'DueDate':
					/**
					 * Gets the value for intDueDate (Not Null)
					 * @return integer
					 */
					return $this->intDueDate;

				case 'LastUpdated':
					/**
					 * Gets the value for intLastUpdated (Not Null)
					 * @return integer
					 */
					return $this->intLastUpdated;

				case 'IncludedInBuildVersion':
					/**
					 * Gets the value for intIncludedInBuildVersion 
					 * @return integer
					 */
					return $this->intIncludedInBuildVersion;

				case 'StartDate':
					/**
					 * Gets the value for dttStartDate 
					 * @return QDateTime
					 */
					return $this->dttStartDate;

				case 'EndDate':
					/**
					 * Gets the value for dttEndDate 
					 * @return QDateTime
					 */
					return $this->dttEndDate;


				///////////////////
				// Member Objects
				///////////////////

				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'ProjectId':
					/**
					 * Sets the value for intProjectId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intProjectId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ReporterId':
					/**
					 * Sets the value for intReporterId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intReporterId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'HandlerId':
					/**
					 * Sets the value for intHandlerId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intHandlerId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DuplicateId':
					/**
					 * Sets the value for intDuplicateId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDuplicateId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Priority':
					/**
					 * Sets the value for intPriority (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPriority = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Severity':
					/**
					 * Sets the value for intSeverity (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intSeverity = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Reproducibility':
					/**
					 * Sets the value for intReproducibility (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intReproducibility = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Status':
					/**
					 * Sets the value for intStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Resolution':
					/**
					 * Sets the value for intResolution (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intResolution = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Projection':
					/**
					 * Sets the value for intProjection (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intProjection = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Eta':
					/**
					 * Sets the value for intEta (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEta = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'BugTextId':
					/**
					 * Sets the value for intBugTextId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intBugTextId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Os':
					/**
					 * Sets the value for strOs (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strOs = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'OsBuild':
					/**
					 * Sets the value for strOsBuild (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strOsBuild = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Platform':
					/**
					 * Sets the value for strPlatform (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPlatform = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Version':
					/**
					 * Sets the value for strVersion (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strVersion = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FixedInVersion':
					/**
					 * Sets the value for strFixedInVersion (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strFixedInVersion = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Build':
					/**
					 * Sets the value for strBuild (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strBuild = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProfileId':
					/**
					 * Sets the value for intProfileId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intProfileId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ViewState':
					/**
					 * Sets the value for intViewState (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intViewState = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Summary':
					/**
					 * Sets the value for strSummary (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strSummary = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'SponsorshipTotal':
					/**
					 * Sets the value for intSponsorshipTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intSponsorshipTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Sticky':
					/**
					 * Sets the value for intSticky (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intSticky = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TargetVersion':
					/**
					 * Sets the value for strTargetVersion (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTargetVersion = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'CategoryId':
					/**
					 * Sets the value for intCategoryId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intCategoryId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DateSubmitted':
					/**
					 * Sets the value for intDateSubmitted (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDateSubmitted = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DueDate':
					/**
					 * Sets the value for intDueDate (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDueDate = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'LastUpdated':
					/**
					 * Sets the value for intLastUpdated (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intLastUpdated = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'IncludedInBuildVersion':
					/**
					 * Sets the value for intIncludedInBuildVersion 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intIncludedInBuildVersion = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'StartDate':
					/**
					 * Sets the value for dttStartDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttStartDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EndDate':
					/**
					 * Sets the value for dttEndDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttEndDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="MantisBugTable"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="ProjectId" type="xsd:int"/>';
			$strToReturn .= '<element name="ReporterId" type="xsd:int"/>';
			$strToReturn .= '<element name="HandlerId" type="xsd:int"/>';
			$strToReturn .= '<element name="DuplicateId" type="xsd:int"/>';
			$strToReturn .= '<element name="Priority" type="xsd:int"/>';
			$strToReturn .= '<element name="Severity" type="xsd:int"/>';
			$strToReturn .= '<element name="Reproducibility" type="xsd:int"/>';
			$strToReturn .= '<element name="Status" type="xsd:int"/>';
			$strToReturn .= '<element name="Resolution" type="xsd:int"/>';
			$strToReturn .= '<element name="Projection" type="xsd:int"/>';
			$strToReturn .= '<element name="Eta" type="xsd:int"/>';
			$strToReturn .= '<element name="BugTextId" type="xsd:int"/>';
			$strToReturn .= '<element name="Os" type="xsd:string"/>';
			$strToReturn .= '<element name="OsBuild" type="xsd:string"/>';
			$strToReturn .= '<element name="Platform" type="xsd:string"/>';
			$strToReturn .= '<element name="Version" type="xsd:string"/>';
			$strToReturn .= '<element name="FixedInVersion" type="xsd:string"/>';
			$strToReturn .= '<element name="Build" type="xsd:string"/>';
			$strToReturn .= '<element name="ProfileId" type="xsd:int"/>';
			$strToReturn .= '<element name="ViewState" type="xsd:int"/>';
			$strToReturn .= '<element name="Summary" type="xsd:string"/>';
			$strToReturn .= '<element name="SponsorshipTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="Sticky" type="xsd:int"/>';
			$strToReturn .= '<element name="TargetVersion" type="xsd:string"/>';
			$strToReturn .= '<element name="CategoryId" type="xsd:int"/>';
			$strToReturn .= '<element name="DateSubmitted" type="xsd:int"/>';
			$strToReturn .= '<element name="DueDate" type="xsd:int"/>';
			$strToReturn .= '<element name="LastUpdated" type="xsd:int"/>';
			$strToReturn .= '<element name="IncludedInBuildVersion" type="xsd:int"/>';
			$strToReturn .= '<element name="StartDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="EndDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('MantisBugTable', $strComplexTypeArray)) {
				$strComplexTypeArray['MantisBugTable'] = MantisBugTable::GetSoapComplexTypeXml();
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, MantisBugTable::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new MantisBugTable();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if (property_exists($objSoapObject, 'ProjectId'))
				$objToReturn->intProjectId = $objSoapObject->ProjectId;
			if (property_exists($objSoapObject, 'ReporterId'))
				$objToReturn->intReporterId = $objSoapObject->ReporterId;
			if (property_exists($objSoapObject, 'HandlerId'))
				$objToReturn->intHandlerId = $objSoapObject->HandlerId;
			if (property_exists($objSoapObject, 'DuplicateId'))
				$objToReturn->intDuplicateId = $objSoapObject->DuplicateId;
			if (property_exists($objSoapObject, 'Priority'))
				$objToReturn->intPriority = $objSoapObject->Priority;
			if (property_exists($objSoapObject, 'Severity'))
				$objToReturn->intSeverity = $objSoapObject->Severity;
			if (property_exists($objSoapObject, 'Reproducibility'))
				$objToReturn->intReproducibility = $objSoapObject->Reproducibility;
			if (property_exists($objSoapObject, 'Status'))
				$objToReturn->intStatus = $objSoapObject->Status;
			if (property_exists($objSoapObject, 'Resolution'))
				$objToReturn->intResolution = $objSoapObject->Resolution;
			if (property_exists($objSoapObject, 'Projection'))
				$objToReturn->intProjection = $objSoapObject->Projection;
			if (property_exists($objSoapObject, 'Eta'))
				$objToReturn->intEta = $objSoapObject->Eta;
			if (property_exists($objSoapObject, 'BugTextId'))
				$objToReturn->intBugTextId = $objSoapObject->BugTextId;
			if (property_exists($objSoapObject, 'Os'))
				$objToReturn->strOs = $objSoapObject->Os;
			if (property_exists($objSoapObject, 'OsBuild'))
				$objToReturn->strOsBuild = $objSoapObject->OsBuild;
			if (property_exists($objSoapObject, 'Platform'))
				$objToReturn->strPlatform = $objSoapObject->Platform;
			if (property_exists($objSoapObject, 'Version'))
				$objToReturn->strVersion = $objSoapObject->Version;
			if (property_exists($objSoapObject, 'FixedInVersion'))
				$objToReturn->strFixedInVersion = $objSoapObject->FixedInVersion;
			if (property_exists($objSoapObject, 'Build'))
				$objToReturn->strBuild = $objSoapObject->Build;
			if (property_exists($objSoapObject, 'ProfileId'))
				$objToReturn->intProfileId = $objSoapObject->ProfileId;
			if (property_exists($objSoapObject, 'ViewState'))
				$objToReturn->intViewState = $objSoapObject->ViewState;
			if (property_exists($objSoapObject, 'Summary'))
				$objToReturn->strSummary = $objSoapObject->Summary;
			if (property_exists($objSoapObject, 'SponsorshipTotal'))
				$objToReturn->intSponsorshipTotal = $objSoapObject->SponsorshipTotal;
			if (property_exists($objSoapObject, 'Sticky'))
				$objToReturn->intSticky = $objSoapObject->Sticky;
			if (property_exists($objSoapObject, 'TargetVersion'))
				$objToReturn->strTargetVersion = $objSoapObject->TargetVersion;
			if (property_exists($objSoapObject, 'CategoryId'))
				$objToReturn->intCategoryId = $objSoapObject->CategoryId;
			if (property_exists($objSoapObject, 'DateSubmitted'))
				$objToReturn->intDateSubmitted = $objSoapObject->DateSubmitted;
			if (property_exists($objSoapObject, 'DueDate'))
				$objToReturn->intDueDate = $objSoapObject->DueDate;
			if (property_exists($objSoapObject, 'LastUpdated'))
				$objToReturn->intLastUpdated = $objSoapObject->LastUpdated;
			if (property_exists($objSoapObject, 'IncludedInBuildVersion'))
				$objToReturn->intIncludedInBuildVersion = $objSoapObject->IncludedInBuildVersion;
			if (property_exists($objSoapObject, 'StartDate'))
				$objToReturn->dttStartDate = new QDateTime($objSoapObject->StartDate);
			if (property_exists($objSoapObject, 'EndDate'))
				$objToReturn->dttEndDate = new QDateTime($objSoapObject->EndDate);
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, MantisBugTable::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->dttStartDate)
				$objObject->dttStartDate = $objObject->dttStartDate->qFormat(QDateTime::FormatSoap);
			if ($objObject->dttEndDate)
				$objObject->dttEndDate = $objObject->dttEndDate->qFormat(QDateTime::FormatSoap);
			return $objObject;
		}


		////////////////////////////////////////
		// METHODS for JSON Object Translation
		////////////////////////////////////////

		// this function is required for objects that implement the
		// IteratorAggregate interface
		public function getIterator() {
			///////////////////
			// Member Variables
			///////////////////
			$iArray['Id'] = $this->intId;
			$iArray['ProjectId'] = $this->intProjectId;
			$iArray['ReporterId'] = $this->intReporterId;
			$iArray['HandlerId'] = $this->intHandlerId;
			$iArray['DuplicateId'] = $this->intDuplicateId;
			$iArray['Priority'] = $this->intPriority;
			$iArray['Severity'] = $this->intSeverity;
			$iArray['Reproducibility'] = $this->intReproducibility;
			$iArray['Status'] = $this->intStatus;
			$iArray['Resolution'] = $this->intResolution;
			$iArray['Projection'] = $this->intProjection;
			$iArray['Eta'] = $this->intEta;
			$iArray['BugTextId'] = $this->intBugTextId;
			$iArray['Os'] = $this->strOs;
			$iArray['OsBuild'] = $this->strOsBuild;
			$iArray['Platform'] = $this->strPlatform;
			$iArray['Version'] = $this->strVersion;
			$iArray['FixedInVersion'] = $this->strFixedInVersion;
			$iArray['Build'] = $this->strBuild;
			$iArray['ProfileId'] = $this->intProfileId;
			$iArray['ViewState'] = $this->intViewState;
			$iArray['Summary'] = $this->strSummary;
			$iArray['SponsorshipTotal'] = $this->intSponsorshipTotal;
			$iArray['Sticky'] = $this->intSticky;
			$iArray['TargetVersion'] = $this->strTargetVersion;
			$iArray['CategoryId'] = $this->intCategoryId;
			$iArray['DateSubmitted'] = $this->intDateSubmitted;
			$iArray['DueDate'] = $this->intDueDate;
			$iArray['LastUpdated'] = $this->intLastUpdated;
			$iArray['IncludedInBuildVersion'] = $this->intIncludedInBuildVersion;
			$iArray['StartDate'] = $this->dttStartDate;
			$iArray['EndDate'] = $this->dttEndDate;
			return new ArrayIterator($iArray);
		}

		// this function returns a Json formatted string using the
		// IteratorAggregate interface
		public function getJson() {
			return json_encode($this->getIterator());
		}


	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

    /**
     * @uses QQNode
     *
     * @property-read QQNode $Id
     * @property-read QQNode $ProjectId
     * @property-read QQNode $ReporterId
     * @property-read QQNode $HandlerId
     * @property-read QQNode $DuplicateId
     * @property-read QQNode $Priority
     * @property-read QQNode $Severity
     * @property-read QQNode $Reproducibility
     * @property-read QQNode $Status
     * @property-read QQNode $Resolution
     * @property-read QQNode $Projection
     * @property-read QQNode $Eta
     * @property-read QQNode $BugTextId
     * @property-read QQNode $Os
     * @property-read QQNode $OsBuild
     * @property-read QQNode $Platform
     * @property-read QQNode $Version
     * @property-read QQNode $FixedInVersion
     * @property-read QQNode $Build
     * @property-read QQNode $ProfileId
     * @property-read QQNode $ViewState
     * @property-read QQNode $Summary
     * @property-read QQNode $SponsorshipTotal
     * @property-read QQNode $Sticky
     * @property-read QQNode $TargetVersion
     * @property-read QQNode $CategoryId
     * @property-read QQNode $DateSubmitted
     * @property-read QQNode $DueDate
     * @property-read QQNode $LastUpdated
     * @property-read QQNode $IncludedInBuildVersion
     * @property-read QQNode $StartDate
     * @property-read QQNode $EndDate
     *
     *

     * @property-read QQNode $_PrimaryKeyNode
     **/
	class QQNodeMantisBugTable extends QQNode {
		protected $strTableName = 'mantis_bug_table';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'MantisBugTable';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'Integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'Integer', $this);
				case 'ReporterId':
					return new QQNode('reporter_id', 'ReporterId', 'Integer', $this);
				case 'HandlerId':
					return new QQNode('handler_id', 'HandlerId', 'Integer', $this);
				case 'DuplicateId':
					return new QQNode('duplicate_id', 'DuplicateId', 'Integer', $this);
				case 'Priority':
					return new QQNode('priority', 'Priority', 'Integer', $this);
				case 'Severity':
					return new QQNode('severity', 'Severity', 'Integer', $this);
				case 'Reproducibility':
					return new QQNode('reproducibility', 'Reproducibility', 'Integer', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'Integer', $this);
				case 'Resolution':
					return new QQNode('resolution', 'Resolution', 'Integer', $this);
				case 'Projection':
					return new QQNode('projection', 'Projection', 'Integer', $this);
				case 'Eta':
					return new QQNode('eta', 'Eta', 'Integer', $this);
				case 'BugTextId':
					return new QQNode('bug_text_id', 'BugTextId', 'Integer', $this);
				case 'Os':
					return new QQNode('os', 'Os', 'VarChar', $this);
				case 'OsBuild':
					return new QQNode('os_build', 'OsBuild', 'VarChar', $this);
				case 'Platform':
					return new QQNode('platform', 'Platform', 'VarChar', $this);
				case 'Version':
					return new QQNode('version', 'Version', 'VarChar', $this);
				case 'FixedInVersion':
					return new QQNode('fixed_in_version', 'FixedInVersion', 'VarChar', $this);
				case 'Build':
					return new QQNode('build', 'Build', 'VarChar', $this);
				case 'ProfileId':
					return new QQNode('profile_id', 'ProfileId', 'Integer', $this);
				case 'ViewState':
					return new QQNode('view_state', 'ViewState', 'Integer', $this);
				case 'Summary':
					return new QQNode('summary', 'Summary', 'VarChar', $this);
				case 'SponsorshipTotal':
					return new QQNode('sponsorship_total', 'SponsorshipTotal', 'Integer', $this);
				case 'Sticky':
					return new QQNode('sticky', 'Sticky', 'Integer', $this);
				case 'TargetVersion':
					return new QQNode('target_version', 'TargetVersion', 'VarChar', $this);
				case 'CategoryId':
					return new QQNode('category_id', 'CategoryId', 'Integer', $this);
				case 'DateSubmitted':
					return new QQNode('date_submitted', 'DateSubmitted', 'Integer', $this);
				case 'DueDate':
					return new QQNode('due_date', 'DueDate', 'Integer', $this);
				case 'LastUpdated':
					return new QQNode('last_updated', 'LastUpdated', 'Integer', $this);
				case 'IncludedInBuildVersion':
					return new QQNode('included_in_build_version', 'IncludedInBuildVersion', 'Integer', $this);
				case 'StartDate':
					return new QQNode('start_date', 'StartDate', 'DateTime', $this);
				case 'EndDate':
					return new QQNode('end_date', 'EndDate', 'DateTime', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'Integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

    /**
     * @property-read QQNode $Id
     * @property-read QQNode $ProjectId
     * @property-read QQNode $ReporterId
     * @property-read QQNode $HandlerId
     * @property-read QQNode $DuplicateId
     * @property-read QQNode $Priority
     * @property-read QQNode $Severity
     * @property-read QQNode $Reproducibility
     * @property-read QQNode $Status
     * @property-read QQNode $Resolution
     * @property-read QQNode $Projection
     * @property-read QQNode $Eta
     * @property-read QQNode $BugTextId
     * @property-read QQNode $Os
     * @property-read QQNode $OsBuild
     * @property-read QQNode $Platform
     * @property-read QQNode $Version
     * @property-read QQNode $FixedInVersion
     * @property-read QQNode $Build
     * @property-read QQNode $ProfileId
     * @property-read QQNode $ViewState
     * @property-read QQNode $Summary
     * @property-read QQNode $SponsorshipTotal
     * @property-read QQNode $Sticky
     * @property-read QQNode $TargetVersion
     * @property-read QQNode $CategoryId
     * @property-read QQNode $DateSubmitted
     * @property-read QQNode $DueDate
     * @property-read QQNode $LastUpdated
     * @property-read QQNode $IncludedInBuildVersion
     * @property-read QQNode $StartDate
     * @property-read QQNode $EndDate
     *
     *

     * @property-read QQNode $_PrimaryKeyNode
     **/
	class QQReverseReferenceNodeMantisBugTable extends QQReverseReferenceNode {
		protected $strTableName = 'mantis_bug_table';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'MantisBugTable';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'ReporterId':
					return new QQNode('reporter_id', 'ReporterId', 'integer', $this);
				case 'HandlerId':
					return new QQNode('handler_id', 'HandlerId', 'integer', $this);
				case 'DuplicateId':
					return new QQNode('duplicate_id', 'DuplicateId', 'integer', $this);
				case 'Priority':
					return new QQNode('priority', 'Priority', 'integer', $this);
				case 'Severity':
					return new QQNode('severity', 'Severity', 'integer', $this);
				case 'Reproducibility':
					return new QQNode('reproducibility', 'Reproducibility', 'integer', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'Resolution':
					return new QQNode('resolution', 'Resolution', 'integer', $this);
				case 'Projection':
					return new QQNode('projection', 'Projection', 'integer', $this);
				case 'Eta':
					return new QQNode('eta', 'Eta', 'integer', $this);
				case 'BugTextId':
					return new QQNode('bug_text_id', 'BugTextId', 'integer', $this);
				case 'Os':
					return new QQNode('os', 'Os', 'string', $this);
				case 'OsBuild':
					return new QQNode('os_build', 'OsBuild', 'string', $this);
				case 'Platform':
					return new QQNode('platform', 'Platform', 'string', $this);
				case 'Version':
					return new QQNode('version', 'Version', 'string', $this);
				case 'FixedInVersion':
					return new QQNode('fixed_in_version', 'FixedInVersion', 'string', $this);
				case 'Build':
					return new QQNode('build', 'Build', 'string', $this);
				case 'ProfileId':
					return new QQNode('profile_id', 'ProfileId', 'integer', $this);
				case 'ViewState':
					return new QQNode('view_state', 'ViewState', 'integer', $this);
				case 'Summary':
					return new QQNode('summary', 'Summary', 'string', $this);
				case 'SponsorshipTotal':
					return new QQNode('sponsorship_total', 'SponsorshipTotal', 'integer', $this);
				case 'Sticky':
					return new QQNode('sticky', 'Sticky', 'integer', $this);
				case 'TargetVersion':
					return new QQNode('target_version', 'TargetVersion', 'string', $this);
				case 'CategoryId':
					return new QQNode('category_id', 'CategoryId', 'integer', $this);
				case 'DateSubmitted':
					return new QQNode('date_submitted', 'DateSubmitted', 'integer', $this);
				case 'DueDate':
					return new QQNode('due_date', 'DueDate', 'integer', $this);
				case 'LastUpdated':
					return new QQNode('last_updated', 'LastUpdated', 'integer', $this);
				case 'IncludedInBuildVersion':
					return new QQNode('included_in_build_version', 'IncludedInBuildVersion', 'integer', $this);
				case 'StartDate':
					return new QQNode('start_date', 'StartDate', 'QDateTime', $this);
				case 'EndDate':
					return new QQNode('end_date', 'EndDate', 'QDateTime', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>
